#include <LPC11xx.h>
#include <stdio.h>
#include <string.h>
#include "uart.h"
#include "bwl.h"
#include "adc.h"
#include "timer32.h"

//typedef enum{
//     OPEN_BEE='a',
//     OPEN_FAN='b',
//		 OPEN_LED='c',
//			OFF_BEE='d'
//}CMD;


void Obtaining_adc_voltage(void);
char buf[50];
float adv;
int main()
{
		
		ADCInit(ADC_CLK);
		uart_init();
		led_init();
		speaker_init();
		fan_init();
		led_on(2);
		delay_ms(1000);
		led_off(2);
		delay_ms(1000);
	
		

	#if 0
		while(1)
		{
			cmd = RecvFromUart();
			switch(cmd)
			{
				case OPEN_BEE:
						
						speaker_op(1);
						
						delay_ms(2000);
						break;
				case OPEN_FAN:
						fan_on();
						delay_ms(2000);
						break;
				case OPEN_LED:
						led_on(2);
						delay_ms(2000);
						break;
				case OFF_BEE:
						speaker_op(0);
						break;
				default:
						SendToUart(cmd);
						break;
			}
		}
		#endif
		
		#if 1
		while(1)
		{
			Obtaining_adc_voltage( );
			int i = 0;
			strlen(buf);
			for(i = 0;i <= strlen(buf);i++)
			SendToUart(buf[i]);
			delay_ms(1000);
		}
		#endif

}

